<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>PintarOS: include/state.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">PintarOS
   </div>
   <div id="projectbrief">Operating System for Smart Card</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Groups</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">state.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="state_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#ifndef STATE_H</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#define STATE_H</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#define STATE_OK                0</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define STATE_ERROR             1</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define STATE_WRONG             2</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define STATE_BLOCKED           3</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment">/********************************/</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment">/*        Data Structure        */</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment">/********************************/</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div>
<div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="structstate__struct.html">   26</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structstate__struct.html">state_struct</a></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;{</div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="structstate__struct.html#a44f444796209e11c168fa0e9f76952c8">   28</a></span>&#160;  uint16_t        <a class="code" href="structstate__struct.html#a44f444796209e11c168fa0e9f76952c8">current</a>;     </div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="structstate__struct.html#aa7aaedf8e6c5652dc25deb09d0cb0f71">   29</a></span>&#160;  uint16_t        <a class="code" href="structstate__struct.html#aa7aaedf8e6c5652dc25deb09d0cb0f71">currentKey</a>;    </div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="structstate__struct.html#a4295fe2f74804188217ce9b1e28ab755">   30</a></span>&#160;  uint16_t        <a class="code" href="structstate__struct.html#a4295fe2f74804188217ce9b1e28ab755">currentRecord</a>;  </div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="structstate__struct.html#ae9028514070f3109f7379b48341b795a">   31</a></span>&#160;  uint8_t         <a class="code" href="structstate__struct.html#ae9028514070f3109f7379b48341b795a">securityState</a>;  </div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;  uint8_t         challenge[CRYPT_BLOCK_LEN];</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;};</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="comment">/**************************/</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="comment">/*        Variable        */</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="comment">/**************************/</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="comment">/**************************/</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="comment">/*        Function        */</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment">/**************************/</span></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="keywordtype">int</span> <a class="code" href="state_8h.html#ae101467a47dda550dcef26f05b434481">State_Init</a>();</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="keywordtype">int</span> <a class="code" href="state_8h.html#a41c8092995bb8b188084202beb1e0b0e">State_ChangeState</a>(<span class="keywordtype">int</span> newState);</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="keywordtype">int</span> <a class="code" href="state_8h.html#a4ca0a5601d8d5ea16c22289dc3d87222">State_Verify</a>(uint8_t *PIN);</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;<span class="keywordtype">void</span> State_GetChallenge( uint8_t * buffer );</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;uint8_t <a class="code" href="state_8h.html#a0dac935fe070faf2365d6061a72279d4">State_VerifyAuth</a>( uint8_t * encrypted );</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;<span class="keywordtype">int</span> <a class="code" href="state_8h.html#abdcb1cbd0922476b3d7f882d04cbe345">State_SetCurrent</a>(uint16_t newfile);</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;<span class="keywordtype">int</span> <a class="code" href="state_8h.html#a929190b9305f805a80adcf4854455572">State_SetCurrentKey</a>(uint16_t newKey);</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;uint16_t <a class="code" href="state_8h.html#aaa85d3ce76908f6b6717f8f97acda925">State_GetCurrent</a>();</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;uint8_t <a class="code" href="state_8h.html#afd31c5608e2aababd8efff1f170c1b2e">State_GetCurrentSecurity</a>();</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;<span class="keywordtype">void</span> <a class="code" href="state_8h.html#a90c042f2a0e18f28efd80da4f488e60e">State_GetCurrentChallenge</a>(uint8_t * buffer);</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="ttc" id="structstate__struct_html"><div class="ttname"><a href="structstate__struct.html">state_struct</a></div><div class="ttdoc">structure of Card State Manager </div><div class="ttdef"><b>Definition:</b> state.h:26</div></div>
<div class="ttc" id="state_8h_html_a929190b9305f805a80adcf4854455572"><div class="ttname"><a href="state_8h.html#a929190b9305f805a80adcf4854455572">State_SetCurrentKey</a></div><div class="ttdeci">int State_SetCurrentKey(uint16_t newKey)</div><div class="ttdoc">Set current EFKey. </div><div class="ttdef"><b>Definition:</b> state.c:129</div></div>
<div class="ttc" id="state_8h_html_abdcb1cbd0922476b3d7f882d04cbe345"><div class="ttname"><a href="state_8h.html#abdcb1cbd0922476b3d7f882d04cbe345">State_SetCurrent</a></div><div class="ttdeci">int State_SetCurrent(uint16_t newfile)</div><div class="ttdoc">Set current file. </div><div class="ttdef"><b>Definition:</b> state.c:120</div></div>
<div class="ttc" id="state_8h_html_a41c8092995bb8b188084202beb1e0b0e"><div class="ttname"><a href="state_8h.html#a41c8092995bb8b188084202beb1e0b0e">State_ChangeState</a></div><div class="ttdeci">int State_ChangeState(int newState)</div><div class="ttdoc">verify security state with PIN </div></div>
<div class="ttc" id="state_8h_html_a90c042f2a0e18f28efd80da4f488e60e"><div class="ttname"><a href="state_8h.html#a90c042f2a0e18f28efd80da4f488e60e">State_GetCurrentChallenge</a></div><div class="ttdeci">void State_GetCurrentChallenge(uint8_t *buffer)</div><div class="ttdoc">Get current challenge. </div><div class="ttdef"><b>Definition:</b> state.c:146</div></div>
<div class="ttc" id="state_8h_html_afd31c5608e2aababd8efff1f170c1b2e"><div class="ttname"><a href="state_8h.html#afd31c5608e2aababd8efff1f170c1b2e">State_GetCurrentSecurity</a></div><div class="ttdeci">uint8_t State_GetCurrentSecurity()</div><div class="ttdoc">Get current security state. </div><div class="ttdef"><b>Definition:</b> state.c:141</div></div>
<div class="ttc" id="structstate__struct_html_aa7aaedf8e6c5652dc25deb09d0cb0f71"><div class="ttname"><a href="structstate__struct.html#aa7aaedf8e6c5652dc25deb09d0cb0f71">state_struct::currentKey</a></div><div class="ttdeci">uint16_t currentKey</div><div class="ttdoc">pointer to current Key EF header </div><div class="ttdef"><b>Definition:</b> state.h:29</div></div>
<div class="ttc" id="state_8h_html_a4ca0a5601d8d5ea16c22289dc3d87222"><div class="ttname"><a href="state_8h.html#a4ca0a5601d8d5ea16c22289dc3d87222">State_Verify</a></div><div class="ttdeci">int State_Verify(uint8_t *PIN)</div><div class="ttdoc">verify security state with PIN </div><div class="ttdef"><b>Definition:</b> state.c:43</div></div>
<div class="ttc" id="structstate__struct_html_a44f444796209e11c168fa0e9f76952c8"><div class="ttname"><a href="structstate__struct.html#a44f444796209e11c168fa0e9f76952c8">state_struct::current</a></div><div class="ttdeci">uint16_t current</div><div class="ttdoc">pointer to current DF header </div><div class="ttdef"><b>Definition:</b> state.h:28</div></div>
<div class="ttc" id="structstate__struct_html_a4295fe2f74804188217ce9b1e28ab755"><div class="ttname"><a href="structstate__struct.html#a4295fe2f74804188217ce9b1e28ab755">state_struct::currentRecord</a></div><div class="ttdeci">uint16_t currentRecord</div><div class="ttdoc">Record number of currently selected EF. </div><div class="ttdef"><b>Definition:</b> state.h:30</div></div>
<div class="ttc" id="structstate__struct_html_ae9028514070f3109f7379b48341b795a"><div class="ttname"><a href="structstate__struct.html#ae9028514070f3109f7379b48341b795a">state_struct::securityState</a></div><div class="ttdeci">uint8_t securityState</div><div class="ttdoc">security state currently active </div><div class="ttdef"><b>Definition:</b> state.h:31</div></div>
<div class="ttc" id="state_8h_html_ae101467a47dda550dcef26f05b434481"><div class="ttname"><a href="state_8h.html#ae101467a47dda550dcef26f05b434481">State_Init</a></div><div class="ttdeci">int State_Init()</div><div class="ttdoc">Initialize State Manager. </div><div class="ttdef"><b>Definition:</b> state.c:9</div></div>
<div class="ttc" id="state_8h_html_aaa85d3ce76908f6b6717f8f97acda925"><div class="ttname"><a href="state_8h.html#aaa85d3ce76908f6b6717f8f97acda925">State_GetCurrent</a></div><div class="ttdeci">uint16_t State_GetCurrent()</div><div class="ttdoc">Get current file. </div><div class="ttdef"><b>Definition:</b> state.c:136</div></div>
<div class="ttc" id="state_8h_html_a0dac935fe070faf2365d6061a72279d4"><div class="ttname"><a href="state_8h.html#a0dac935fe070faf2365d6061a72279d4">State_VerifyAuth</a></div><div class="ttdeci">uint8_t State_VerifyAuth(uint8_t *encrypted)</div><div class="ttdoc">verify security state with External Authenticate </div><div class="ttdef"><b>Definition:</b> state.c:86</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Jun 4 2014 18:13:31 for PintarOS by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
